package com.saicmotor.springboot_demo.mapper;

import com.saicmotor.springboot_demo.model.User;
import com.saicmotor.springboot_demo.model.UserRole;
import com.saicmotor.springboot_demo.model.UserRoleInfo;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface UserRoleMapper {
    void insertUserRoleInfo(int userId,int roleId);

    List<UserRole> getAll();

    List<UserRoleInfo> getAllInfo();

    void deleteByUserId(int userId);

    void deleteByRoleId(int roleId);

    void updateUser(int oldUserId,int newUserId,int roleId);

    void updateRole(int oldRoleId,int newRoleId,int userId);

    List<Integer> getIdByUserRole(int userId, int roleId);

    void createUserRoleTable(@Param(value = "tableName") String tableName);

    List<Integer> getIdByUserId(@Param(value = "tableName") String tableName,int userId);

    List<Integer> getIdByRoleId(@Param(value = "tableName") String tableName,int roleId);
}
